from rest_framework import serializers
from .models import Thesis

class ThesisDto(serializers.Serializer):
    user_id = serializers.IntegerField()
    first_author = serializers.CharField()
    corresponding_author = serializers.CharField()
    title = serializers.CharField()
    journal = serializers.CharField()
    pub_year = serializers.CharField()
    thesis_partition = serializers.CharField()
    impact_factor = serializers.CharField()

class ThesisModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = Thesis
        fields = ['first_author', 'corresponding_author', 'title', 'journal', 'pub_year', 'thesis_partition', 'impact_factor']

class ThesisPageQuery(serializers.Serializer):
    page = serializers.DictField()
    query = ThesisModelSerializer()

class IPageThesisModel(serializers.Serializer):
    records = ThesisModelSerializer(many=True)
    total = serializers.IntegerField()
    size = serializers.IntegerField()
    current = serializers.IntegerField()
    orders = serializers.ListField(child=serializers.DictField())
    optimize_count_sql = serializers.BooleanField()
    search_count = serializers.BooleanField()
    optimize_join_of_count_sql = serializers.BooleanField()
    count_id = serializers.CharField()
    max_limit = serializers.IntegerField()
    pages = serializers.IntegerField()